import request from '@/utils/request'

// 创建新对话
export function createDialogue() {
  return request({
    url: '/ai/webChat/createDialogue',
    method: 'post',
    data: {}
  })
}

// 发送聊天消息
export function sendChatMessage(data) {
  return request({
    url: '/ai/webChat/chat',
    method: 'post',
    data: data
  })
}

// 获取历史对话列表
export function listDialogues(query) {
  return request({
    url: '/ai/webChat/dialogueList',
    method: 'get',
    params: query
  })
}

// 获取特定对话的聊天记录
export function getChatHistory(dialogueId) {
  return request({
    url: '/ai/webChat/history',
    method: 'post',
    data: {
      dialogueId: dialogueId
    }
  })
}

// 删除对话
export function deleteDialogue(dialogueId) {
  return request({
    url: '/ai/webChat/deleteDialogue/' + dialogueId,
    method: 'post'
  })
}

// 获取聊天剩余次数
export function getChatRemainingCount() {
  return request({
    url: '/ai/webChat/getChatNum',
    method: 'get'
  })
}
